//
//  LspNbNavigationBar.swift
//  LspSwiftFinayTest
//
//  Created by lsp's mac pro on 2018/3/28.
//  Copyright © 2018年 lsp's mac pro. All rights reserved.
//

import UIKit

class LspNbNavigationBar: UINavigationBar {

    override func layoutSubviews() {
        super.layoutSubviews();
        
        if #available(iOS 11.0, *) {
            //注意导航栏及状态栏高度适配
            frame = CGRect(x: 0, y: 0, width: frame.width, height: frame.height)
            for view in subviews {
                let viewbg = subviews[0];//_UIBarBackground
                let viewcon = subviews[2];//_UINavigationBarContentView
                print(view);
                if(view == viewbg){
                    view.frame = bounds;
                }else if(view == viewcon){
                    var frame = view.frame;
                    frame.origin.y = 20;
                    frame.size.height = self.bounds.size.height - frame.origin.y;
                    view.frame = frame;
                }
            }
        }else {
            
        }
       
    }

}
